#define _CRT_SECURE_NO_WARNINGS  1
#include <iostream>
#include<vector>
#include<math.h>
using namespace std;

int max_yueshu(int a, int b)
{
    int n = a * b;
    for (int i = sqrt(n); i >= 2; i--)
    {
        if (a % i == 0 && b % i == 0)
        {
            return i;
        }
    }

    return 0;
}


int main()
{
    int n, a;
    while (cin >> n >> a)
    {
        vector<int> v(n);
        for (int i = 0; i < n; i++)
        {
            cin >> v[i];
            if (v[i] <= a)
            {
                a += v[i];
            }
            else
            {
                a += max_yueshu(v[i], a);
            }
        }

        cout << a << endl;

    }

 
}


#include <iostream>
#include<string>
#include<set>
using namespace std;

int main()
{
    string s;
    cin >> s;
    bool flag = false;
    multiset<char> st;
    for (auto ch : s)
    {
        st.insert(ch);
    }

    for (auto ch : s)
    {
        if (st.count(ch) == 1)
        {
            cout << ch << endl;
            flag = true;
            break;
        }

    }

    if (!flag)
        cout << "-1";
    return 0;

}